declare const x: string | number; if (x) {}

<T extends number | bigint | string>(x: T) => x ? 1 : 0;